package com.kyg.tjtoolmanager.ui;

import com.kyg.tjtoolmanager.module.Reader;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.layout.HBox;

public class ItemReader extends ListCell<Reader> {

    @Override
    protected void updateItem(Reader reader, boolean empty) {
        super.updateItem(reader, empty);
        if (empty || reader == null) {
            setGraphic(null);
        } else {
            HBox box = new HBox(10);
            box.setAlignment(Pos.CENTER_LEFT);
            box.setPrefHeight(20);
//            box.setStyle("-fx-background-color:#FF82A8");
            Label lbReaderType = new Label(reader.getReaderType());
            lbReaderType.setPrefWidth(100);
            Label lbConType = new Label(reader.getConnectType());
            lbConType.setPrefWidth(200);
            Label lbAdd = new Label(reader.getAddress());
            lbAdd.setPrefWidth(50);
            lbAdd.setStyle("-fx-background-color:#FF82A8");
            box.getChildren().addAll(lbReaderType,lbConType,lbAdd);
            setGraphic(box);
        }
    }


}
